<?php 
if(!isset($_SESSION)) session_start();


if (isset($_REQUEST["study_year"])) $study_year = $_REQUEST["study_year"];
else if (isset($_SESSION["study_year"])) $study_year = $_SESSION["study_year"];

if (isset($_REQUEST["search_subject"])) $search_subject = $_REQUEST["search_subject"];
else if (isset($_SESSION["search_subject"])) $search_subject = $_SESSION["search_subject"];

if (isset($_REQUEST["search_category"])) $search_category = $_REQUEST["search_category"];
else if (isset($_SESSION["search_subject"])) $search_category = $_SESSION["search_category"];
else $search_category="";


header("Content-type: text/xml"); 
//echo $_SESSION["study_year"];
//$study_year = $_SESSION["study_year"];
//$study_year = 2011;

//http://www.peterborough.ac.uk/prc/service.asmx/SubjectAreaSearch?StudyYear=2011&SubjectAreaCode=146&Category=

$params = "StudyYear={$study_year}&SubjectAreaCode={$search_subject}&Category={$search_category}";

$xml = simplexml_load_file("http://{$_SERVER['SERVER_NAME']}/WebServices/PRC/service.asmx/SubjectAreaSearch?{$params}");
$xml = str_replace("utf&#x2013;8", "utf-8", $xml);
echo $xml;

?>